package com.ajobs.project.comp;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 属性加载顺序优先级
 * 文档中心：https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config
 */
@Component
public class PropertiesLoadOrderComponent implements InitializingBean {

    /**
     * 覆盖: fg
     * 程序参数 fg 环境变量 fg application.yml
     *
     * json示例：
     *  SPRING_APPLICATION_JSON={"my":{"name":"test"}}; // name=test
     */
    @Value("${my.name}")
    private String name;

    @Override
    public void afterPropertiesSet() throws Exception {

        // System.out.println(name);

    }
}
